package com.sxt.util;

import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class ParseActionConfig {
	public static Map<String, ActionMapping> parseActionConfig() {
		Map<String, ActionMapping> actionsConfig = new HashMap<String, ActionMapping>();
		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
		try {
			DocumentBuilder builder = factory.newDocumentBuilder();
			InputStream inputXml = ParseActionConfig.class.getClassLoader().getResourceAsStream("actions-config.xml");
			Document doc = builder.parse(inputXml);
			NodeList actions = doc.getElementsByTagName("action");  //存放所有action
			
			for (int i = 0; i < actions.getLength(); i++) {
				Element action = (Element) actions.item(i);
				String name = action.getAttribute("name");
				String actionClassName = action.getAttribute("className");
				
			}
			
		} catch(Exception e) {
			
		}
		
		return null;
	}
}
